<template>
  <div class="powerPage">
    <img v-if="lan=='en'" class="topImg" src="../../assets/img/banner-2-en.png" alt />
    <img v-if="lan=='zh'" class="topImg" src="../../assets/img/banner-2.png" alt />
    <div class="powerDiv1">
      <p>{{$t('dasai[0]')}}</p>
    </div>
    <p class="powerP1">
      {{$t('dasai[1]')}}
    </p>
    <div class="powerDiv2">
      <p>{{$t('dasai[2]')}}</p>
      <p>{{$t('dasai[3]')}}</p>
      <p>{{$t('dasai[4]')}}</p>
    </div>
    <div class="powerDiv2 powerDiv3" v-for="(item,index) in competitionlistData">
      <p>{{item.sort}}</p>
      <p>{{item.name_en?item.name_en:item.name_cn}}</p>
      <p>{{item.profit}}USDT</p>
      <i
        :class="`dd${item.sort-1}`"
        :style="`width:${parseFloat(item.profit)/num*100}%`"
        v-if="item.sort<4"
      ></i>
    </div>
    <div v-for="item in competitionruleData" v-if="item.type==1">
      <div class="powerDiv1">
        <p>{{item.title}}</p>
      </div>
      <p class="powerP2" v-html="item.content"></p>
    </div>

    <div v-for="item in competitionruleData" v-if="item.type==2">
      <div class="powerDiv1">
        <p>{{item.title}}</p>
      </div>
      <div v-html="item.content" style="margin-top:50px"></div>
      <!-- <div class="powerDiv4">
      <div class="powerDiv4Div1">
        <p>第一名：</p>
        <p>奖励为50000.00USDT</p>
        <p>第二名：</p>
        <p>奖励为30000.00USDT</p>
        <p>第三名：</p>
        <p>奖励为12000.00USD</p>
      </div>
      <p class="powerDiv4p1">
        注：合约大赛除平台奖励外无任何其他奖励，平台不
        会以任何形式像您索要个人信息以及钱包密钥，平台
        参赛为自愿报名制，平台会拿出一定量的USDT作为
        奖励，合约大赛旨在增加技术交流，不会承诺任何收
        益，数字货币合约为高风险类衍生产品，不具备高风
        险投资的团队和个人请勿参与，请每一个参赛队伍做
        好风控工作。
        凡承诺收益的参赛队伍一经发现马上取消参赛资格。
      </p>
      </div>-->
    </div>
    <div v-for="item in competitionruleData" v-if="item.type==3">
      <div class="powerDiv1">
        <p>{{item.title}}</p>
      </div>
      <div v-html="item.content" style="margin-top:50px"></div>
      <!-- <div class="powerDiv5">
        <p>
          数字资产是创新型投资品，价格波动较大，具有较高的投资风险。投资前望您对数字资产充分认知
          理性判断投资能力，审慎做出投资决策。
        </p>
        <p>
          活动期间用户可自行组织，或用队长邀请链接注册加入团队，如已经注册的用户想加入战队请联系官
          方活动客服。中途不可主动退出或更换团队
        </p>
        <p>
          【团队赛】：比拼收益额，整个团队收益金额依次排名； 资格：邀请20名实名用户即可，并享受专属
          邀请海报、队长返佣等福利。获奖团队队长独得30%奖金，队员瓜分其余70%
        </p>
      </div> -->
    </div>
    <div style="height:50px"></div>
  </div>
</template>
<script>
import { competitionrule, competitionlist } from "@/api/software";
export default {
  data() {
    return {
      competitionruleData: null,
      competitionlistData: null,
      num: 1,
      lan:'en'
    };
  },
  created() {
    let la = localStorage.getItem("lang");
    if (la) {
      if (la == "zh") {
        this.lan = "zh";
      }
      // else if (la == "tw") {
      //   this.lan = "繁體中文";
      // } else if (la == "ja") {
      //   this.lan = "日本語";
      // } else if (la == "ko") {
      //   this.lan = "한국어";
      // } else {
      //   this.lan = "English";
      // }
    }
    competitionlist()
      .then(res => {
        
          this.competitionlistData = res;
          let num = 0;
          for (var i = 0; i < res.length; i++) {
            num += parseFloat(res[i].profit);
          }
          this.num = num;
              
      })
      .catch(res => {
        
      });
    competitionrule()
      .then(res => {
         
          this.competitionruleData = res;
        
      })
      .catch(res => {
        
      });
  }
};
</script>
<style lang="less">
.powerPage p {
  text-align: center;
}
.powerDiv5 {
  width: 1010px;
  background: rgba(188, 162, 117, 0.2);
  border: 1px solid rgba(188, 162, 117, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px 0;
  margin: 50px 0;
  p {
    width: 741px;
    text-align: center;
  }
  p:nth-child(1) {
    font-size: 16px;
    color: rgba(164, 139, 96, 1);
    line-height: 26px;
    margin-bottom: 60px;
  }
  p:nth-child(2) {
    font-size: 16px;
    color: #222222;
    line-height: 26px;
    margin-bottom: 60px;
  }
  p:nth-child(3) {
    font-size: 16px;
    color: #222222;
    line-height: 26px;
  }
}
.powerDiv4 {
  background: url("../../assets/img/dsjl-img.png");
  background-size: 100% 100%;
  width: 1010px;
  margin: 50px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 50px 30px;
  .powerDiv4Div1 {
    p:nth-child(1),
    p:nth-child(3),
    p:nth-child(5) {
      font-size: 24px;
      color: #ffffff;
      margin-top: 10px;
    }
    p:nth-child(2),
    p:nth-child(4),
    p:nth-child(6) {
      font-size: 24px;
      color: #bca275;
      margin-top: 10px;
    }
  }
  .powerDiv4p1 {
    width: 338px;
    font-size: 14px;
    color: rgba(188, 162, 117, 1);
    line-height: 20px;
  }
}
.powerP2 {
  font-size: 16px;
  color: rgba(188, 162, 117, 1);
  line-height: 26px;
  margin: 50px 0;
}
.powerP1 {
  width: 470px;
  font-size: 16px;
  color: rgba(102, 102, 102, 1);
  line-height: 22px;
  margin: 50px 0;
}
.powerDiv2 {
  width: 1010px;
  height: 66px;
  background: rgba(255, 255, 255, 1);
  padding: 20px 24px;
  margin-top: 10px;
  position: relative;
  p {
    font-size: 14px;
    color: rgba(134, 134, 134, 1);
    position: absolute;
  }
  p:nth-child(1) {
    left: 34px;
  }
  p:nth-child(2) {
    left: 245px;
  }
  p:nth-child(3) {
    right: 27px;
  }
}

.powerDiv3 {
  position: relative;
  width: 1010px;
  height: 66px;
  background: rgba(255, 255, 255, 1);
  box-shadow: 0px 0px 9px 1px rgba(26, 26, 26, 0.06);
  border-radius: 10px;
  .dd0 {
    background: rgba(255, 224, 3, 1);
  }
  .dd1 {
    background: rgba(230, 227, 231, 1);
  }
  .dd2 {
    background: rgba(215, 176, 133, 1);
  }
  i {
    z-index: 2;
    height: 100%;
    position: absolute;
    right: 0;
    top: 0;
    display: block;
    border-radius: 0px 10px 10px 0px;
  }
  p {
    font-size: 16px;
    color: rgba(34, 34, 34, 1);
    line-height: 26px;
    z-index: 9;
    font-weight: 600;
  }
  p:nth-child(3) {
    font-size: 24px;
    font-weight: 400;
  }
}
.powerPage {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.powerDiv1 {
  padding: 17px 94px 30px 94px;
  background-image: url("../../assets/img/zdpm-bg.png");
  background-size: 100% 100%;
  display: inline-block !important;
  margin-top: 50px;
  p {
    font-size: 36px;
    color: rgba(255, 255, 255, 1);
  }
}
.topImg {
  width: 100%;
  height: 587px;
}
</style>